You are here: About publishing jobs > Registering documents for publication > Registering programmatically without the Task Server

Registering programmatically without the Task Server

Registering a document for publishing without the Task Server involves bypassing the Task Server and creating entries directly in the Meridian Enterprise Server database. Entries can be created by using the MeridianQueue object from within VBScript, a PowerUser user interface extension, or a .NET application.

Registering without using the Task Server has the advantage that no Task Server installation or hardware resources are required. This simplifies your system configuration. However, the disadvantage of registering without the Task Server is that it requires more complicated programing on your part to register documents for publishing. For information about programmatically registering documents using the Task Server, see Registering programmatically with the Task Server.

You can take one of the following approaches to creating the database records:

To register documents without using the Task Server:

  1. Call the RegisterDocument method of the MeridianQueue object and pass at least a Document object and JobCode (publishing job name) property as shown in the following examples. For more information about the MeridianQueue object, see About the MeridianQueue object.

The task can be submitted by any event or command where a Document object exists. For more information about the Submit method, see the BlueCielo Meridian Enterprise VBScript API Reference.

Notes

Example using Meridian Enterprise VBScript

Sub PublishCommand_Execute(Batch)
  On Error Resume Next
  'Create the script object
  Dim Publisher
  Set Publisher = New PublisherScriptObject  
  'Register the selected document for publishing.
  Call Publisher.Queue.RegisterDocument("", "Job", Document.ID, , , , , ,"Custom.StringProperty")
  'Release the script object.
  Set Publisher = Nothing   
  If Err.Number <> 0 Then  
	  WinMsgBox "Publish failed: " +  Err.Description
  End If
End Sub

'Represents a wrapper of a COM object accessible from VBScript.
'Provides deterministic release of resources.
Class PublisherScriptObject
  Private underlyingObject

  'Initializes the COM object.
  Private Sub Class_Initialize()
      Set underlyingObject = AMCreateObject("BCPublisher.MeridianQueue")
    End Sub

  'Releases the COM object.
  Private Sub Class_Terminate()
      underlyingObject.Dispose()
        Set underlyingObject = Nothing
  End Sub

  'Gets the COM object.
  Public Property Get Queue
    Set Queue = underlyingObject
  End Property

End Class

Example using a Meridian Enterprise VB.NET extension

Private Sub btnPublish_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  Handles btnPublish.Click

  Dim publisherQueue As Object = Nothing
  ' Get the selected document to publish.
  Dim document As BCDocument = ExtensionHost.CurrentObject

  Dim vaultId = String.Format( _
    "\\{0}\{1}", _
    ExtensionHost.Repository.AMServer.Address, _
    ExtensionHost.Repository.DataStoreName)

  Try
    ' Create the publisher object.
    ' Add a second parameter set to True to create the object on the server instead
    ' if automatic downloads to client computers are prohibited.
    publisherQueue = CreateObject("BCPublisher.MeridianQueue")

    ' Register the document for publishing.
    publisherQueue.RegisterDocument( _ 
      vaultId, "3BA9DF", document.ID, , , , , , "Custom.PublishStatus")

  Finally
    ' If the object was initialized, dispose explicitly.
    If publisherQueue IsNot Nothing Then
      publisherQueue.Dispose()
      publisherQueue = Nothing
    End If
  End Try
End Sub

Example using a Meridian Enterprise VB.NET application

Private Sub DoIt(ByVal repository As BCRepository)
  Dim publisherQueue As Object = Nothing

  ' Get document to publish.
  Dim document As BCDocument = repository.GetFSObject("\MyDocument.doc")
  ' Compile the vault identifier.
  Dim vaultId = String.Format("\\{0}\{1}", repository.AMServer.Address, repository.DataStoreName)

  Try
    ' Create the publisher object.
    publisherQueue = CreateObject("BCPublisher.MeridianQueue")

    ' Register the document for publishing.
    publisherQueue.RegisterDocument( _ 
      vaultId, "3BA9DF", document.ID, , , , , , "Custom.PublishStatus")

  Finally
    ' If the object was initialized, dispose explicitly.
    If publisherQueue IsNot Nothing Then
      publisherQueue.Dispose()
      publisherQueue = Nothing
    End If
  End Try
End Sub

Related concepts

Registering documents for publication

Related tasks

Registering on demand in Meridian Enterprise

Registering programmatically with the Task Server